package cn.edu.just.firstjavaapp.l15;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class BytesCopy {
    public static void main(String[] args)  {
        FileInputStream fis = null;
        FileOutputStream fos = null;
        try {
            fis = new FileInputStream("C:\\java2024demo\\src\\io\\xanadu.txt");
            fos = new FileOutputStream("c:/java/aaa.txt");
            int c;
            while (((c = fis.read()) != -1)) {
                fos.write(c);
            }
        }catch (IOException e){
            System.out.println("文件操作错误");
        }finally {
            try {
                if(fis!=null)
                    fis.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            try {
                if(fos!=null)
                    fos.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

    }
}
